#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

bool nums[100];

class Solution1
{
public:
    bool check(int num)
    {
        vector<int> bits;
        while (num)
        {
            int cur = num % 10;
            if (cur)
                bits.push_back(cur);
            num /= 10;
        }
        if (bits.size() < 2) return false;

        int n = bits.size();
        for (int i = 0; i < n; ++i)
        {
            for (int j = i + 1; j < n; ++j)
            {
                int num1 = bits[i]; int num2 = bits[j];
                if (nums[num1 * 10 + num2] || nums[num2 * 10 + num1])
                    return true;
            }
        }

        return false;
    }

    int solve()
    {
        memset(nums, false, sizeof(nums));
        for (int i = 2; i < 100; ++i)
        {
            bool flag = true;
            for (int j = 2; j <= i / j; ++j)
            {
                if (i % j == 0)
                {
                    flag = false;
                    break;
                }
            }
            if (flag) nums[i] = true;
        }

        int a, b;
        cin >> a >> b;

        int res = 0;
        for (int i = a; i <= b; ++i)
        {
            if (check(i))
                res++;
        }

        cout << res;

        return 0;
    }
};

class Solution2
{
public:
    inline bool check(char c)
    {
        return c == 'G' || c == 'C';
    }

    int solve()
    {
        string str; cin >> str;
        int len; cin >> len;

        int n = str.size(), cur = 0;
        string res;
        for (int i = 0; i <= len - 1; ++i)
        {
            if (check(str[i]))
                cur++;
            res.push_back(str[i]);
        }

        int left = 0, right = len - 1, mx = cur;
        for (int l = 1, r = len; r < n; ++l, ++r)
        {
            if (check(str[l - 1])) --cur;
            if (check(str[r])) ++cur;
            if (cur > mx)
            {
                left = l; right = r;
                mx = cur;
            }
        }

        cout << str.substr(left, right - left + 1);

        return 0;
    }
};

